package com.chinairi.mall.dao;

import com.chinairi.mall.model.ProjectPlanReqDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.chinairi.mall.service.modelobject.PurchaseDetailAndOrderMO;
import com.chinairi.mall.service.modelobject.StorageFlatMO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 需求建议计划表 Mapper 接口
 * </p>
 *
 * @author gsl
 * @since 2020-10-20
 */
public interface ProjectPlanReqDetailMapper extends BaseMapper<ProjectPlanReqDetail> {
    /**
     * 批量更新需求数量
     * @param purchaseDetailAndOrderMoList
     */
    void batchUpdate(@Param("purchaseDetailAndOrderMoList") List<PurchaseDetailAndOrderMO> purchaseDetailAndOrderMoList);
    /**
     * 获取需求计划下的物料详情
     *
     * @param planReqId
     * @return
     */
    List<ProjectPlanReqDetail> getList(@Param("planReqId") String planReqId,@Param("planPurchaseId") String planPurchaseId);

    /**
     * 获取需求计划下某种物料数量
     *
     * @param planReqId
     * @param planMatCode
     * @return
     */
    Integer countReqMat(@Param("planReqId") String planReqId, @Param("planMatCode") String planMatCode);

    /**
     * 需求计划下是否有该物料
     * @param planReqId 需求计划id
     * @param planMatCode 物料id
     * @return i
     */
    Integer isExistMat(@Param("planReqId") String planReqId, @Param("planMatCode") String planMatCode);

    /**
     * 根据需求计划详情主键找到详细信息。
     *
     * @param planDetailIdList
     * @return
     */
    List<ProjectPlanReqDetail> getListForPurchaseAdd(@Param("planDetailIdList") List<String> planDetailIdList);

    /**
     * 批量插入采购计划
     *
     * @param projectPlanReqDetailList
     */
    void batchInsert(@Param("projectPlanReqDetailList") List<ProjectPlanReqDetail> projectPlanReqDetailList);

    /**
     * 批量更新
     * @param storageFlatMoList
     */
    void batchUpdateByPick (@Param("storageFlatMoList") List<StorageFlatMO> storageFlatMoList);

    /**
     * 绑定采购计划
     * @param projectPlanReqDetailList 采购计划id
     */
    void updatePurchaseId(@Param("projectPlanReqDetailList") List<ProjectPlanReqDetail> projectPlanReqDetailList);

    Float getShoppingCarNum(@Param("planPurchaseId") String planPurchaseId,@Param("planMatCode") String planMatCode);
}
